﻿using Ordering.Domain.Seedwork;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace Ordering.Domain.AggregatesModel.OrderAggregate
{
    /// <summary>
    /// 地址
    /// </summary>
    public class Address :  Entity, IAggregateRoot
    {
        /// <summary>
        /// 省
        /// </summary>
        public String Province { get; private set; }
        /// <summary>
        /// 市
        /// </summary>
        public String City { get; private set; }
        /// <summary>
        /// 区
        /// </summary>
        public String Area { get; private set; }
        /// <summary>
        /// 街道（镇）
        /// </summary>
        public String Town { get; private set; }
        /// <summary>
        /// 详细地址
        /// </summary>
        public string DetailedAddress { get; private set; }
        /// <summary>
        /// 扩展字段（订单为取快递类型则为：快递店地址）
        /// </summary>
        public string ExtendField { get; private set; }
        /// <summary>
        /// 经度(用户)
        /// </summary>
        [Column(TypeName = "decimal(18,8)")]
        public decimal? Latitude { get; set; }
        /// <summary>
        /// 纬度(用户)
        /// </summary>
        [Column(TypeName = "decimal(18,8)")]
        public decimal? Longitude { get; set; }

        public Address() { }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="province">省</param>
        /// <param name="city">市</param>
        /// <param name="area">区</param>
        /// <param name="detailedAddress">详细地址</param>
        /// <param name="latitude">经度</param>
        /// <param name="longitude">纬度</param>
        /// <param name="extendField">扩展字段</param>
        public Address(string province, string city, string area, string town, string detailedAddress,decimal? latitude,decimal? longitude,string extendField = "")
        {
            this.Province = province;
            this.City = city;
            this.Area = area;
            this.DetailedAddress = detailedAddress;
            this.Latitude = latitude;
            this.Longitude = longitude;
            this.Town = town;
            this.ExtendField = extendField;
        }
    }
}
